print('欢迎光临超市，以下是在售物品：')
list1 = ['烟20元','酒50元','糖100元',]
list2 = ['购物小票：']
print(list1)
i = 500
o = 0
while True:
     buy = (input('请输入你想购买的物品，按q结束购物:'))
     if buy == '烟20元':
        print('加入购物车成功')
        if i < 20:
           print('钱不够啊，买不了了')
           break
        else:
          i = i - 20
        o = 0 + 20
        print('剩余钱:',i)
        list2.insert(2,'烟20元')
     elif buy == '酒50元':
        print('加入购物车成功')
        if i < 50:
           print('钱不够啊，买不了了')
           break
        else:
         i = i - 50
        o = 0 + 50
        print('剩余钱:', i)
        list2.insert(2, '酒50元')
     elif buy == '糖100元':
        print('加入购物车成功')
        if i < 100:
           print('钱不够啊，买不了了')
           break
        else:
         i = i - 100
        o = 0 + 100
        print('剩余钱:', i)
        list2.insert(2, '糖100元')
     elif buy == 'q':
         break
     else: print('没有该商品，请重新输入')
print(list2)
print('你卡上还有：',i,'元')